﻿using ControleRepresentante.Data.Catalogs;
using ControleRepresentante.Data.Helpers;

namespace ControleRepresentante.Data.CatalogSteps
{
    internal class CreateTransportadoraCatalogStep : CatalogStepBase<ControleRepresentanteCatalogStepTypes>
    {
        protected override ControleRepresentanteCatalogStepTypes CatalogStepType
        {
            get { return ControleRepresentanteCatalogStepTypes.CreateTransportadora; }
        }

        public override void Execute(IDataAccess dataAccess)
        {
            CatalogStepHelper catalogStepHelper = new CatalogStepHelper(dataAccess);

            catalogStepHelper
                .CreateTable("Transportadora", false, "UsuariosHolderId")
                    .AddForeignKey("UsuariosHolderId", "UsuariosHolder", "DetailsHolderId")
                    .AddColumn("Nome", ColumnType.LongString, false, false);

            catalogStepHelper
                .CreateTable("TransportadoraJolitex")
                    .AddColumn("Codigo", ColumnType.ShortNumeric, true, false);
        }
    }
}